<script type="text/javascript">
$(function () {
	$.ajaxSetup({cache: false});
	classRoom_queryAidClasses();
});

function classRoom_queryAidClasses() {
	sys_loading();
	var parm = $('#classRoom_queryAidClassesForm').serialize();
	var url = create_url('classRoom-aidList');
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#classRoom_classesResultList').html(result);
		}
	});
}

function saveEditClassRoomItem(){
	var clc = $("#clc").val();
	if(clc == null || clc == ''){
		sys_warning('请选择使用教室的班级');
		return;
	}
	var parm = $('#editAidClassRoomItemForm').serialize();
	var url = create_url('classRoom-saveItem');
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			result = JSON.parse(result);
			if (result.result == 'success') {
				$('#calendar').fullCalendar('refetchEvents');//重新渲染或有事件
				$.fn.colorbox.close();
				sys_msg('操作成功');
			} else {
				sys_warning('操作失败，请刷新后重试');
			}
		}
	});
}
 
function classRoom_choiseClasses(code, name){
	$("#title").val(name);
	$("#clc").val(code);
}
</script>
<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<form id="editAidClassRoomItemForm" style="width: 350px;float: left;">
	<div class="panel panel-default">
		<div class="panel-heading"><strong>编辑教室使用信息</strong></div>
		<table class="search_term_table">
			<tr>
				<td style="width: 80px;">班级</td>
				<td>
					<input id="title" class="form-control ng-pristine ng-invalid ng-invalid-required" type="text" name="title" value="${(title)!''}" readonly="readonly" />
					<input id="id" type="hidden" name="code" value="${id}" />
					<input id="crc" type="hidden" name="crc" value="${(crc)!''}" />
					<input id="clc" type="hidden" name="clc" value="${(clc)!''}" />
				</td>
			</tr>
			<tr>
				<td>开始时间</td>
				<td>
					${(start)!''}
					<input type="hidden" id="startTime" name="startTime" value="${(start)!''}" />
				</td>
			</tr>
			<tr>
				<td>结束时间</td>
				<td>
					${(end)!''}
					<input type="hidden" id="endTime" name="endTime" value="${(end)!''}" />
					<input type="hidden" id="allDay" name="allDay" value="${(allDay)!''}" />
				</td>
			</tr>
			<#if deleted??>
			<tr>
				<td>是否屏蔽</td>
				<td><@mt.YesOrNo r=true name='deleted' d=false mc=true /></td>
			</tr>
			</#if>
			<tr>
				<td>备注</td>
				<td><textarea class="form-control" style="resize: none;" id="remark" name="remark" rows="3">${(remark)!''}</textarea></td>
			</tr>
			
			<tr>
				<td colspan="2" style="text-align: center;">
					<a class="btn btn-xs btn-info" onclick="javascript: saveEditClassRoomItem(); return false;"  title="保存" ><i class="icon-save"></i>保存</a>&nbsp;&nbsp;&nbsp;
					<a class="btn btn-xs btn-primary" onclick="javascript: $.fn.colorbox.close(); return false;" title="关闭">关闭</a>
				</td>
			</tr>
		</table>
	</div>
</form>
<div class="panel panel-default" style="width: 400px;float: right;">
	<div class="panel-heading"><strong>选择班级</strong></div>
		<form id="classRoom_queryAidClassesForm">
			<table class="search_term_table">
				<tr>
					<th style="width:80px;">班级名称:</th>
					<td>
						<input class="form-control w_input170" type="text" name="name" />
					</td>
					<td style="text-align: center;">
						<button class="btn m-b-xs w-xs btn-info" onclick="javascript: classRoom_queryAidClasses(); return false;"><i class="fa fa-search"></i> 查  询</button>
					</td>
				</tr>
			</table>
		</form>
	<div id="classRoom_classesResultList" style="width: 400px;float: left;"></div>
</div>
